package com.albaba.designpattern.observer.text_002;

import java.util.Date;

/**
 * @Description: TODO
 * @Author zx
 * @Date 2025/2/24 15:44
 * @Version 1.0
 */
public class LotteryServiceImpl implements LotteryService {

    // 注入摇号服务
    private DrawHouseService houseService = new DrawHouseService();

    @Override
    public LotteryResult lottery(String uId) {
        // 摇号
        String lots = houseService.lots(uId);
        // 发短信
        System.out.println("发送短信通知用户,ID为：" + uId + "摇号结果为：" + lots);
        // 发送MQ信息
        System.out.println("记录用户摇号结果到MQ,ID为：" + uId + "摇号结果为：" + lots);

        return new LotteryResult(uId, lots,new Date());
    }
}
